package com.leyou.search.service;

import com.leyou.search.entity.Goods;
import com.leyou.search.entity.SearchParamDTO;
import com.leyou.starter.elastic.entity.PageInfo;
import org.elasticsearch.action.search.SearchRequest;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Map;

public interface SearchService {
    /**
     * 创建索引库并设置映射
     */
    void createIndexAndMapping();

    /**
     * 加载数据到索引库
     */
    void loadData();

    Mono<List<String>> getSuggest(String key);


    Mono<Map<String, List<?>>> listFilter(SearchParamDTO searchParamDTO);

    Mono<PageInfo<Goods>> searchGoods(SearchParamDTO request);

    /**
     * 新增一个商品到索引库
     * @param spuId 商品spuId
     */
    void saveGoodsById(Long spuId);

    /**
     * 从索引库删除一个商品
     * @param spuId 商品spuId
     */
    void deleteGoodsById(Long spuId);
}
